interface IUser {
    id: number,
    name: string
}

const user: IUser = {
    id: 1,
    name: "xiaowang",
}

//array类型是数组,IUser类型数组
const array: IUser[] = [
    { id: 1, name: "xiaowang" },
    { id: 2, name: "xiaofei" },
]

interface ITeacher {
    id: number;
    name: string;
}
interface IClasses {
    id: number;
    classesName: string;
    teacher: ITeacher
}
const array2:IClasses[] = [
    {
        id: 1, classesName: "web32", teacher: {
            id: 1, name: "王"
        }
    },
    {
        id: 2, classesName: "web33", teacher: {
            id: 1, name: "刘"
        }
    }
]

const teachers:ITeacher[] = [
    { id: 1, name: "张" }
]

//类型申明
type mydata = {
    id:number
}
//联合类型
type mydata2 = ITeacher | IClasses | undefined


interface IStudent {
    cardId:number,
    stuName:string,
    phoneNumber?:string,
    //接口或者type声明时候,遇到函数类型 ()=>void
    call:(param:number)=>void
}
const student:IStudent = {
    cardId:1,stuName:"xiaowang",phoneNumber:"123",call:function(){}
}


interface IMyUser {
    address:string,
    phone:string
}
function checkUser(user:IMyUser):IMyUser[]{
    const array = []
    array.push(user)
    return array
}
checkUser({
    address:"",
    phone:""
})


